package com.smashcrush.client.gwt.service;

import java.util.Map;

import com.google.code.jsonrpc.client.JsonRemoteService;
import com.google.code.jsonrpc.client.POST;
import com.google.code.jsonrpc.client.Path;
import com.google.code.jsonrpc.client.PathParam;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smashcrush.model.BrowserType;
import com.smashcrush.model.ExecuteScriptParameters;

/**
 * The client side stub for the RPC service.
 */
public interface BrowserServiceAsync extends JsonRemoteService {

	public static class RPC {
		public static BrowserServiceAsync get() {
			BrowserServiceAsync ourInstance = GWT
					.create(BrowserServiceAsync.class);
			return ourInstance;
		}
	}

	@POST
	@Path("/api/browser/openSession/token/{token}/browserType/{browserType}/domain/{domain}")
	public void openSession(@PathParam("token") String token,
			@PathParam("browserType") BrowserType browserType,
			@PathParam("domain") String domain, AsyncCallback<String> callback);

	@POST
	@Path("/api/browser/closeSessiontoken/{token}/sessionId/{sessionId}")
	public void closeSession(@PathParam("token") String token,
			@PathParam("sessionId") String sessionId,
			AsyncCallback<Void> callback);

	@POST
	@Path("/api/browser/executeScript/token/{token}/sessionId/{sessionId}")
	public void executeScript(@PathParam("token") String token,
			@PathParam("sessionId") String sessionId,
			ExecuteScriptParameters parameters,
			AsyncCallback<Map<String, String>> callback);

	@POST
	@Path("/api/browser/executeScriptByName/token/{token}/sessionId/{sessionId}/domain/{domain}/name/{name}")
	public void executeScriptByName(
			@PathParam("token") String token,
			@PathParam("sessionId") String sessionId,
			@PathParam("domain") String domain, @PathParam("name") String name,
			ExecuteScriptParameters parameters,
			AsyncCallback<Map<String, String>> callback);

}
